<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会议纪要模版</title>
    <link rel="stylesheet" href="../css/all.min.css">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.8;
            margin: 0;
            padding: 0;
            background-color: #fff;
        }
        
        .container {
            max-width: 210mm;
            min-height: 297mm;
            margin: 20px auto;
            padding: 20mm;
            background-color: white;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
        }
        
        h1 {
            text-align: center;
            font-size: 28px;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #f5f5f5;
        }
        
        h2 {
            font-size: 22px;
            border-bottom: 1px solid #f5f5f5;
        }
        
        p {
            margin-bottom: 15px;
            display: flex;
            align-items: center;
        }
        
        strong {
            min-width: 80px;
            display: inline-block;
            font-size: 22px;
        }
        
        .editable {
            padding: 5px 8px;
            border-radius: 4px;
            min-width: 0;
            flex-grow: 1;
        }
        
        .participants {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 15px;
            align-items: center;
        }
        
        .participant-item {
            padding: 6px 12px;
            border-radius: 20px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        
        .participant-item i {
            color: #667eea;
            font-size: 14px;
        }
        
        .absent-item {
            background: #ffebee;
            padding: 6px 12px;
            border-radius: 20px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        
        .absent-item i {
            color: #ea4335;
            font-size: 14px;
        }
        
        .add-btn {
            background: #667eea;
            color: white;
            border: none;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            margin-top: 5px;
        }
        
        .toolbar {
            position: fixed;
            top: 50%;
            right: 20px;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 10px;
            z-index: 1000;
        }
        
        .btn {
            padding: 12px 15px;
            border: none;
            border-radius: 50px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            display: flex;
            align-items: center;
            gap: 8px;
            color: white;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 8px rgba(0,0,0,0.15);
        }
        
        /* Photo upload styles */
        .photo-upload {
            margin-top: 20px;
        }
        
        .photo-preview {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 15px;
        }
        
        .photo-container {
            position: relative;
            border: 1px solid #ddd;
            border-radius: 5px;
            overflow: hidden;
        }
        
        .photo-thumbnail {
            width: 100%;
        }
        
        .photo-remove {
            position: absolute;
            top: 5px;
            right: 5px;
            background: #ea4335;
            color: white;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 12px;
            display: none;
        }
        
        .photo-container:hover .photo-remove {
            display: flex;
        }
        
        .upload-btn {
            background: #f1f1f1;
            border: 1px dashed #ccc;
            width: 150px;
            height: 150px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            border-radius: 5px;
            transition: all 0.3s;
        }
        
        .upload-btn:hover {
            background: #e9e9e9;
            border-color: #999;
        }
        
        .upload-btn i {
            font-size: 24px;
            color: #666;
            margin-bottom: 8px;
        }
        
        .upload-btn span {
            font-size: 12px;
            color: #666;
        }
        
        #fileInput {
            display: none;
        }

        @media print {
            .toolbar {
                display: none;
            }
            
            .container {
                box-shadow: none;
                padding: 20mm;
                margin: 0;
                width: 210mm;
                min-height: 297mm;
            }
            
            body {
                background-color: white;
                margin: 0;
                padding: 0;
            }
            
            .photo-remove, .upload-btn {
                display: none !important;
            }
        }
    </style>
</head>

<body>
    <div class="toolbar">
        <button class="btn" id="editBtn">
            <i class="fas fa-edit"></i>
            <span>编辑文档</span>
        </button>
        <button class="btn" id="printBtn">
            <i class="fas fa-print"></i>
            <span>打印文档</span>
        </button>
    </div>
    
    <div class="container">
        <h1 contenteditable="false" class="editable" data-placeholder="编辑会议标题">会议纪要</h1>

        <p><strong>会议主题：</strong><span contenteditable="false" class="editable" data-placeholder="输入会议主题"></span></p>
        <p><strong>会议时间：</strong><span contenteditable="false" class="editable" data-placeholder="输入会议时间"></span></p>
        <p><strong>会议地点：</strong><span contenteditable="false" class="editable" data-placeholder="输入会议地点"></span></p>

        <h2>参会人员</h2>
        <div class="participants" id="attendeesContainer">
            
        </div>
        <button class="add-btn" id="addAttendeeBtn" style="display:none;"><i class="fas fa-plus"></i></button>

        <h2>缺席人员</h2>
        <div class="participants" id="absenteesContainer">
            
        </div>
        <button class="add-btn" id="addAbsenteeBtn" style="display:none;"><i class="fas fa-plus"></i></button>

        <h2>会议内容</h2>
        <div contenteditable="false" class="editable" style="min-height: 100px;" data-placeholder="输入会议内容..."></div>

        <h2>会议照片</h2>
        <div class="photo-upload">
            <div class="photo-preview" id="photoPreview"></div>
            <div class="upload-btn" id="uploadBtn" style="display:none;">
                <i class="fas fa-camera"></i>
                <span>选择照片</span>
                <input type="file" id="fileInput" accept="image/*" multiple>
            </div>
        </div>
    </div>

    <script>
        const editables = document.querySelectorAll('.editable');
        const editBtn = document.getElementById('editBtn');
        const printBtn = document.getElementById('printBtn');
        const addAttendeeBtn = document.getElementById('addAttendeeBtn');
        const addAbsenteeBtn = document.getElementById('addAbsenteeBtn');
        const attendeesContainer = document.getElementById('attendeesContainer');
        const absenteesContainer = document.getElementById('absenteesContainer');
        const uploadBtn = document.getElementById('uploadBtn');
        const fileInput = document.getElementById('fileInput');
        const photoPreview = document.getElementById('photoPreview');
        
        let isEditing = false;
        let photos = [];
        
        editBtn.addEventListener('click', function() {
            isEditing = !isEditing;
            
            if (isEditing) {
                editBtn.innerHTML = '<i class="fas fa-times"></i><span>取消编辑</span>';
                addAttendeeBtn.style.display = 'flex';
                addAbsenteeBtn.style.display = 'flex';
                uploadBtn.style.display = 'flex';
            } else {
                editBtn.innerHTML = '<i class="fas fa-edit"></i><span>编辑文档</span>';
                addAttendeeBtn.style.display = 'none';
                addAbsenteeBtn.style.display = 'none';
                uploadBtn.style.display = 'none';
            }
            
            editables.forEach(item => {
                item.contentEditable = isEditing;
            });
        });
        
        printBtn.addEventListener('click', function() {
            window.print();
        });
        
        addAttendeeBtn.addEventListener('click', function() {
            const newAttendee = document.createElement('div');
            newAttendee.className = 'participant-item editable';
            newAttendee.contentEditable = true;
            newAttendee.setAttribute('data-placeholder', '点击输入参会人员');
            newAttendee.innerHTML = `
                <i class="fas fa-user"></i>
                <span>新参会人员</span>
            `;
            attendeesContainer.appendChild(newAttendee);
        });
        
        addAbsenteeBtn.addEventListener('click', function() {
            const newAbsentee = document.createElement('div');
            newAbsentee.className = 'absent-item editable';
            newAbsentee.contentEditable = true;
            newAbsentee.setAttribute('data-placeholder', '点击输入缺席人员');
            newAbsentee.innerHTML = `
                <i class="fas fa-user-times"></i>
                <span>新缺席人员</span>
            `;
            absenteesContainer.appendChild(newAbsentee);
        });
        
        // Photo upload functionality
        uploadBtn.addEventListener('click', function() {
            fileInput.click();
        });
        
        fileInput.addEventListener('change', function(e) {
            const files = e.target.files;
            for (let i = 0; i < files.length; i++) {
                const file = files[i];
                if (file.type.match('image.*')) {
                    const reader = new FileReader();
                    
                    reader.onload = function(e) {
                        const photo = {
                            url: e.target.result,
                            date: new Date().toLocaleString()
                        };
                        photos.push(photo);
                        renderPhotos();
                    }
                    
                    reader.readAsDataURL(file);
                }
            }
        });
        
        function renderPhotos() {
            photoPreview.innerHTML = '';
            photos.forEach((photo, index) => {
                const container = document.createElement('div');
                container.className = 'photo-container';
                container.innerHTML = `
                    <img src="${photo.url}" class="photo-thumbnail">
                    <div class="photo-remove" data-index="${index}">
                        <i class="fas fa-times"></i>
                    </div>
                `;
                photoPreview.appendChild(container);
                
                // Add remove event
                container.querySelector('.photo-remove').addEventListener('click', function(e) {
                    e.stopPropagation();
                    const index = parseInt(this.getAttribute('data-index'));
                    photos.splice(index, 1);
                    renderPhotos();
                });
            });
        }
    </script>
</body>

</html>